import { withCors } from '../../../lib/cors';
const { success, error, handleResponse } = require('../../../lib/response');

async function handler(req, res) {
  const assetAPIs = {
    title: "资产管理API接口",
    description: "提供学校资产管理数据的全面分析接口",
    version: "1.0.0",
    tableInfo: {
      tableName: "wd_sec_assets12",
      description: "学校资产管理表",
      fields: {
        CAIZXJFLY: "财政拨款",
        BASE_TEACHER_NAME_KEEPER: "领用人姓名",
        ASSETS_SORT_GGJ_NAME: "国管局分类名称",
        PURCHASE_DATE: "购买日期",
        CHEKMJ: "房屋车库面积",
        ASSETS_SORT_GB22_NAME: "新国标分类名称",
        FENTMJ: "土地房屋分摊面积",
        STATE: "现状",
        STOCK_PRICE: "入库时资产价格"
      }
    },
    endpoints: [
      {
        path: "/api/asset/basic-stats",
        method: "GET",
        name: "基础统计",
        description: "获取资产总数、总价值、总面积等基础统计数据"
      },
      {
        path: "/api/asset/category-stats", 
        method: "GET",
        name: "分类统计",
        description: "按国管局分类和新国标分类统计资产数量和价值"
      },
      {
        path: "/api/asset/financial-analysis",
        method: "GET", 
        name: "财务分析",
        description: "财政拨款分析、价格分析等财务数据统计"
      },
      {
        path: "/api/asset/area-analysis",
        method: "GET",
        name: "面积分析", 
        description: "房屋车库面积和土地分摊面积的统计分析"
      },
      {
        path: "/api/asset/time-analysis",
        method: "GET",
        name: "时间分析",
        description: "按购买时间的趋势分析和统计"
      },
      {
        path: "/api/asset/personnel-stats",
        method: "GET",
        name: "人员管理",
        description: "领用人相关统计分析"
      },
      {
        path: "/api/asset/status-analysis",
        method: "GET", 
        name: "现状分析",
        description: "资产现状统计和分析"
      }
    ]
  };

  return handleResponse(res, success(assetAPIs, "资产管理API信息获取成功"));
}

export default withCors(handler, ['GET']);